package impl_v2.factory;

import impl_v1.AuctionInformationImpl;
import impl_v1.AuctionPrivateImpl;
import impl_v1.AuctionPublicImpl;
import impl_v1.BidImpl;
import impl_v1.ItemImpl;
import impl_v1.WinnerInformationImpl;
import impl_v2.AuctioningSystemImpl2;

import java.rmi.RemoteException;

import model.AuctionInformation;
import model.AuctionPrivate;
import model.AuctionPublic;
import model.Bid;
import model.Item;
import model.WinnerInformation;
import model.factory.Factory;
import model.server.AuctioningSystem2;

public class FactoryImpl2 implements Factory {

	public FactoryImpl2() throws RemoteException {
		super();
	}
	
	@Override
	public AuctioningSystem2 getAuctioningSystem() {
		try {
			return new AuctioningSystemImpl2(this);
		} catch (RemoteException e) {
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public AuctionPrivate newAuctionPrivate(int reservePrice, int key, int startingPrice, Item item) {
		return new AuctionPrivateImpl(reservePrice, key, startingPrice, item);
	}

	@Override
	public AuctionPublic newAuctionPublic(int startingPrice, Item item) {
		return new AuctionPublicImpl(startingPrice, item);
	}

	@Override
	public Bid newBid(int price, String name, String email) {
		return new BidImpl(price, name, email);
	}

	@Override
	public Item newItem(String title, String description) {
		return new ItemImpl(title, description);
	}

	@Override
	public AuctionInformation newAuctionInformation(int auctionID, int key) {
		return new AuctionInformationImpl(auctionID, key);
	}

	@Override
	public WinnerInformation newBuyerInformation(String name, String email, int finishingPrice) {
		return new WinnerInformationImpl(name, email, finishingPrice);
	}

	@Override
	public AuctionPublic newAuctionPublic(AuctionPrivate auction) {
		return new AuctionPublicImpl(auction);
	}

}
